1. Field of the Invention
The present invention relates generally to digital audio and/or video data storage and playback, and, more particularly, to seeking a particular time point within a Moving Pictures Expert Group (MPEG) file.
2. Description of the Related Art
Developments in processing and storage technology have greatly expanded the ability of individuals to use microprocessor based devices for the recording and playback of sounds and images. As an example, individuals may now download songs onto a solid-state memory storage device, such as a portable MP3 player, and play the recorded song back at any time. In the area of moving pictures (with or without sound), MPEG is a popular standard for the recording and playback of digitally stored audio-visual files. The MPEG format provides an effective mechanism for efficiently compressing and decompressing digital video and/or audio signals and for supplying the decompressed signals to a playback mechanism for viewing. Although there are different versions of the MPEG standard, such as the old MPEG-1, the current MPEG-2, and the new MPEG-4, the term “MPEG” will be used herein to reference video and/or audio encoding and decoding algorithms and protocols promulgated in old, current, and future versions of MPEG.
Although MPEG plays back the stored audio-visual content at a constant frame rate, the standard stores the audio-visual content using a variable data rate. This is done to maximize the storage capacity of an MPEG file by taking advantage of the fact that sections of a video image do not change from frame to frame. Because these sections do not change, there is no need to store the data representing those sections when storing each sequential frame. Thus, the MPEG format encodes and records only those parts of sequential frames that are altered from frame to frame. But this results in the number of bytes representing a frame varying from frame to frame, depending on the amount of alteration between frames.
Because the stored MPEG format has a variable data rate (the number of bytes representing one frame may be twenty times greater than the number of bytes representing the next frame) but the frames are viewed (played back) at a constant data rate (usually between 30 and 50 frames per second), it is difficult to perform a seek, or jump, function (such as fast-forwarding to particular time point) in an MPEG file. To move through a MPEG file to a particular time point (or playback location), known as “seeking”, prior art systems have resorted to parsing through the entire file until the time point (or frame number) that was sought is encountered in the encoded data. This method of seeking is time-consuming and uses up precious processing resources to perform the parsing.
Various solutions have been suggested in the prior art for the seek problem. In U.S. Pat. No. 5,630,005, a requested playback location referenced by a time or frame number is approximated by using the upper rate bound (maximum data rate) from a system header of the MPEG file. The method multiplies the upper rate bound by the requested playback time (which can be calculated from the frame number) in order to determine an approximate byte location in the MPEG file. A time stamp in the MPEG file near to the approximate byte location is read to determine whether the approximate byte location matches the requested playback time to within a predetermined degree. If it does not match within the predetermined degree, a new data rate is calculated and is used to determine a new approximate location. This repeats until a match is found. However, in practice, the upper rate bound is often set to 15 Mb/s by default, regardless of the actual value, to ensure that all rate variations will be covered, resulting in very large errors when the approximate byte location is calculated, requiring many iterations of the method before finding a correct match. Furthermore, recalculating the data rate during each iteration is wasteful of processing resources.
In U.S. Pat. No. 5,715,176, the requested playback location is approximated by calculating a byte rate using the system clock reference (SCR) bits in nearby pack headers. The MPEG data stream is broken down into packs, each of which consist of header information and a series of data packets. The pack header information includes the SCR, which is a snapshot of the system clock (of the original encoder). Each packet within the pack also has header information, which includes the time stamps mentioned above. The two SCRs neighboring the current byte position are found. The byte rate is calculated by using the distances (in bytes) between the current position and the two SCRs and the difference in time between the two SCRs. Having found the byte rate, an approximate byte location is determined and found (thus becoming the current byte position). A nearby time stamp is found and it is determined whether the approximate byte location matches the requested playback time within a predetermined degree. If it does not, the byte rate is re-calculated using the currently neighboring SCRs, and the process repeats. This means that the byte rate is being continually recalculated as the process iterates, thus using up processing resources.
In U.S. Pat. No. 5,864,682, the MPEG file is parsed to create a tag file, which may be used to determine seek positions within the MPEG file. However, this method requires the creation, processing, and storage of an additional file, which is wasteful of both processing and storage resources.
In U.S. Pat. No. 6,157,771, the requested playback location is approximated by first estimating the total number of frames in the MPEG file and then estimating the byte location using the estimated total number of frames, the file size in bytes, and the target frame number. The method then subtracts a predetermined number of seconds (in bytes) from the estimated byte location and then jumps to that calculated position. It is determined whether the next group of pictures (GOP) header indicates a frame number greater than the target frame number. GOPs hold many frames and are several orders of magnitude greater in size than packs or packets. If the indicated frame number is greater than the target frame number, the method backs up to the previous GOP header and reads a predetermined number of frames forward to identify the target frame. If the indicated frame number is not greater, the method jumps to the next GOP header and repeats. However, this type of seeking works best if the bit rate is constant, and may involve a great deal of jumping in MPEG files that have a great variation in the number of bytes per frame.
Therefore, there is a need for a system and method of seeking a particular point within an MPEG file without using too much processing and/or storage resources while still being sufficiently accurate.